namespace ITU.EtermCore
{
    using System;
    using System.Text;
    using System.Text.RegularExpressions;

    public class PrintPacket : Packet
    {
        private string eirno;
        private string tktno;

        public PrintPacket(string tktno, string eirno, EtermConnection.CmdResultCB cb) : base(Command.StringToBytes("01 00 00 32 0c 00 00 01 8c 0c 00 02 50 52 49 4e 56 20 39 39 39 33 31 35 34 38 35 32 34 37 36 2c 7b 49 54 54 4e 3d 34 30 32 39 35 36 32 30 38 38 7d 03"), 50, cb)
        {
            if (!(Regex.IsMatch(tktno, "[0-9]{13}") && Regex.IsMatch(eirno, "[0-9]{10}")))
            {
                throw new Exception("tktno参数必须为13位数字,eirno参数必须为10位数字");
            }
            this.tktno = tktno;
            this.eirno = eirno;
        }

        internal override void bulidpacket()
        {
            byte[] bytes = Encoding.Default.GetBytes(this.tktno);
            byte[] buffer2 = Encoding.Default.GetBytes(this.eirno);
            bytes.CopyTo(base.EncodeCmdBytes, 0x12);
            buffer2.CopyTo(base.EncodeCmdBytes, 0x26);
        }
    }
}
